<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <meta name="csrf-param" content="_csrf">
    <meta name="csrf-token" content="">
    <title>报名确认表</title>
    <!--iOS中隐藏Safari浏览器的UI:Start-->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <!--iOS中隐藏Safari浏览器的UI:End-->
    <!--iOS Safari对页面数字禁用拨号功能:Start-->
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="email=no">
    <!--iOS Safari对页面数字禁用拨号功能:End-->
    <link rel="stylesheet" href="/css/mobile.css">
    <link rel="stylesheet" href="/js/layui/css/layui.css">
    <script src="/js/jquery.min.js"></script>
    <script src="/js/rem.js"></script>
    <script src="/js/TouchSlide.1.1.js"></script>
    <script src="/js/layui/layui.js"></script>
    <script src="/js/jweixin-1.6.0.js"></script>
    <script>
        layui.use(['layer'], function(){
            var layer = layui.layer
        });
    </script>
</head>
<body class="body_main" >
<div id="index_banner">
    <div class="ban_tab">
        <ul>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </div>
    <div class="ban_imp">
        <ul>
            <li><img src="/img/bannar1.jpg"  /></li>
            <li><img src="/img/bannar2.jpg"   /></li>
            <li><img src="/img/bannar3.jpg"   /></li>
            <li><img src="/img/bannar4.jpg"/></li>
            <li><img src="/img/bannar5.jpg" /></li>
            <li><img src="/img/bannar6.jpg"  /></li>
            <li><img src="/img/bannar7.jpg"   /></li>
            <li><img src="/img/bannar8.jpg"   /></li>
            <li><img src="/img/bannar9.jpg"/></li>
            <li><img src="/img/bannar10.jpg" /></li>
            <li><img src="/img/bannar11.jpg"  /></li>
            <li><img src="/img/bannar12.jpg"   /></li>
            <li><img src="/img/bannar13.jpg"   /></li>

        </ul>
    </div>
</div>
<!--header_div end-->
<div class="sign_up">
    <div class="sign_up_biao">
        <h1>报名表</h1>
        <div class="sign_up_link">
            <a>
                <span class="sign_up_detail">详情</span>
                <img src="/img/sign_img.jpg" />
                <h2>神农杯—燕赵文化银龄展演</h2>
            </a>
        </div>
    </div>
    <!--sign_up_biao-->
    <div class="sign_up_form">


        <form>
            <div class="sign_up_item">
                <label><span>&nbsp;</span>表演人数</label>
                <div class="sign_up_select grey"><?php echo $persons ?></div>
            </div>
            <div class="sign_up_item">
                <label><span>&nbsp;</span>服务费用</label>
                <div class="sign_up_select grey"><?php echo $tips ?> 元</div>
            </div>
            <div class="sign_up_item">
                <label><span>&nbsp;</span>费用说明</label>
                <div class="sign_up_text_more grey">本费用包含赛事全程的餐饮、住宿及景区接驳交通等基础保障服务。赛事期间将为参与者提供每日营养餐食（含早中晚三餐）、赛事指定合作酒店的标准住宿（双人间为主），以及景区内大巴车定点接驳服务，确保选手从驻地至赛场的无缝衔接。上述费用已统一纳入报名套餐，旨在为参赛者提供全程无忧的后勤支持，让您更专注于赛事体验，畅享运动与自然融合的旅程。</div>
            </div>
            <!--div class="sign_up_item noborder">
                <label><span>&nbsp;</span>付款方式</label>
                <div class="sign_up_select grey">长按识别二维码付款</div>
                <div class="pay_code"><img  src="/img/code.jpg"></div>
            </div-->

            <div class="form_submit">
                <div class="form_submit_text">
                    <span>神农杯--燕赵文化银龄展演</span>
                    <em>提交</em>
                </div>
            </div>
        </form>

    </div>
    <!--show_box-->
    <script type="text/javascript">
        // 确保 WeixinJSBridge 已加载
        if (typeof WeixinJSBridge === "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        } else {
            onBridgeReady();
        }
        function onBridgeReady() {
            /*WeixinJSBridge.invoke(
                'getBrandWCPayRequest', {
                    "appId": "{{ appId }}",
                    "timeStamp": "{{ timeStamp }}",
                    "nonceStr": "{{ nonceStr }}",
                    "package": "{{ package }}",
                    "signType": "{{ signType }}",
                    "paySign": "{{ paySign }}"
                },
                function(res){
                    if(res.err_msg == "get_brand_wcpay_request:ok" ){
                        alert('支付成功');
                    } else {
                        alert('支付失败');
                    }
                }
            );*/
            console.log("待支付");
        }
    </script>

    <script type="text/javascript">
        var signUpId = "<?php echo $signUpId; ?>";
        var token = "<?php echo $token; ?>";
        $(function(){
            $(".form_submit_text").click(function (){
                $.post("/pay/order", {signUpId: signUpId, token: token}, function(data){
                    if(data.code == 0){
                        WeixinJSBridge.invoke(
                            'getBrandWCPayRequest', {
                                "appId": data.data.appId,
                                "timeStamp": data.data.timeStamp,
                                "nonceStr": data.data.nonceStr,
                                "package": data.data.package,
                                "signType": data.data.signType,
                                "paySign": data.data.paySign
                            },
                            function(res) {
                                if (res.err_msg === "get_brand_wcpay_request:ok") {
                                    layer.msg('支付成功');
                                    window.location.href="/";// 跳转到支付成功页面
                                } else {
                                    if(res.err_msg === "get_brand_wcpay_request:cancel"){
                                        layer.msg('支付失败，支付过程中用户取消');
                                    }else{
                                        layer.msg('支付失败，请刷新后重试');
                                    }
                                }
                            }
                        );
                    }else{
                        layer.msg('提交支付失败: ' + data.msg);
                    }
                });
            });
        })
    </script>
</body>
</html>